
<%@ page import="auctionhaus.Listing" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'listing.label', default: 'Listing')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#list-listing" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
                <sec:ifAllGranted roles="ROLE_USER">
                    <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
                </sec:ifAllGranted>
                <sec:ifAllGranted roles="ROLE_ADMIN">
                    <li><g:link class="list" action="list" controller="customer"><g:message code="customer.listing.label"/></g:link> </li>
                </sec:ifAllGranted>
			</ul>
		</div>
		<div id="list-listing" class="content scaffold-list" role="main">
            <g:if test="${listingInstanceMine}">
                <h1><g:message code="mine.list.label" args="[entityName]" /></h1>
            </g:if>
            <g:else>
                <h1><g:message code="default.list.label" args="[entityName]" /></h1>
            </g:else>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<table>
				<thead>
					<tr>
					
						<!--<g:sortableColumn property="description" title="${message(code: 'listing.description.label', default: 'Description')}" />-->
					
						<g:sortableColumn property="name" title="${message(code: 'listing.name.label', default: 'Name')}" />
					
						<!--<th><g:message code="listing.winner.label" default="Winner" /></th> -->

                        <g:sortableColumn property="numBids" title="${message(code: 'listing.numBids.label', default: 'Number of Bids')}" />

                        <g:sortableColumn property="startingBidPrice" title="${message(code: 'listing.startingBidPrice.label', default: 'Starting Bid Price')}" />

                        <g:sortableColumn defaultOrder="desc" property="dateCreated" title="${message(code: 'listing.dateCreated.label', default: 'Date Created')}" />

						<g:sortableColumn property="endDateTime" title="${message(code: 'listing.endDateTime.label', default: 'End Date Time')}" />

					</tr>
				</thead>
				<tbody>
				<g:each in="${listingInstanceList}" status="i" var="listingInstance">
					<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
					
						<!--<td><g:link action="show" id="${listingInstance.id}">${fieldValue(bean: listingInstance, field: "description")}</g:link></td>-->
					
						<td><g:link action="show" id="${listingInstance.id}">${fieldValue(bean: listingInstance, field: "name")}</g:link></td>

                        <td>${listingInstance.bids.size()}</td>

						<!--<td>${fieldValue(bean: listingInstance, field: "winner")}</td>-->

                        <td>${fieldValue(bean: listingInstance, field: "startingBidPrice")}</td>

                        <td><g:formatDate date="${listingInstance.dateCreated}" /></td>

						<td><g:formatDate date="${listingInstance.endDateTime}" /></td>

					</tr>
				</g:each>
				</tbody>
			</table>
			<div class="pagination">
				<!--<g:paginate total="${listingInstanceTotal}" />-->
                <g:if test="${listingInstanceMine}">
                    <g:paginate controller="listing" action="listMine" total="${listingInstanceTotal}" next="Next" prev="Previous" maxsteps="0" max="5"/>
                </g:if>
                <g:else>
                    <g:paginate controller="listing" action="list" total="${listingInstanceTotal}" next="Next" prev="Previous" maxsteps="0" max="5"/>
                </g:else>
            </div>
		</div>
	</body>
</html>
